<template>
	<view class="content">
		
		<view class="topBox" @tap="btnSet">
			<image class="headImage" :src="data.headimgurl" mode=""></image>
			<view class="right">
				<view class="name overflow_one">{{data.nickname}}</view>
				<view class="id overflow_one fontSize12">{{data.user_sign}}</view>
			</view>
			<uni-icons class="icon" type="arrowright"  color="white" size="12"/>
			<view class="clearBoth"></view>
		</view>
		
		<view class="bg_box">
			<view class="isBg" :style="{backgroundImage:'url('+data.bg+')'}">
				<view class="leftBox">
					<view class="name">全家全员</view>
					<view class="names">平均{{data.money}}元/一年</view>
				</view>
				<view class="btnGo" @tap="ToVip">立即开通</view>
				<view class="clearBoth"></view>
			</view>
		</view>
		
		<view class="bg_grey">
			<view class="rowsList">
				<view class="orderTitleBox">
					<view class="name">商城订单</view>
					<view class="nameRight" @tap="toOrder(-1)">全部订单	<uni-icons class="icon" type="arrowright"  color="#BBBBBB" size="12"/></view>
					<view class="clearBoth"></view>
				</view>
				<view class="iconList">
					<view class="iconBox" v-for="(item,index) in iconList" :key="index" @tap="toOrder(index)">
						<image class="icon" :src="item.src" mode=""></image>
						<view class="iconName">{{item.name}}</view>
					</view>
				</view>
			</view>
			
			<view class="bg_whites">
				<view class="iconList">
					<view class="iconBox" v-for="(item,index) in toolsList" :key="index" @tap="toolBtn(index)">
						<image class="icon" :src="item.src" mode=""></image>
						<view class="iconName">{{item.name}}</view>
					</view>
				</view>
			</view>
			
			<!-- <view class="imageBox bg_whites" @tap="tapAdv">
				<view class="leftBox">
					<image class="iconName" src="/static/mine/icon_11.png" mode="widthFix"></image>
					<view class="nameBox">
						<view class="name">欢迎大家关注单领</view>
						<view class="getBtn">立即领取<uni-icons class="icon" type="arrowright"  color="white" size="12"/></view>
					</view>
				</view>
				<image class="rightImage" src="/static/mine/icon_12.png" mode="widthFix"></image>
				<view class="clearBoth"></view>
			</view> -->
			
			<!-- <image :src="data.ad_pic" mode="widthFix"></image> -->
			
			<view class="rowsList bg_whites">
				<view class="orderTitleBox">
					<view class="name">我的服务</view>
					<view class="clearBoth"></view>
				</view>
				<view class="iconLists">
					<view class="marginTop" v-for="(item,index) in serversList" :key="index" @tap="btnServers(index)">
						<image class="icon" :src="item.src" mode="" v-show="index!==6"></image>
						<view class="iconName" v-show="index!==6">{{item.name}}</view>
						<button open-type="contact" bindcontact="handleContact"  v-show="index==6">
							<image class="icon" :src="item.src" mode="" v-show="index==6"></image>
							<view class="iconName" v-show="index==6">{{item.name}}</view>
						</button>
					</view>
				</view>
			</view>
		</view>
		
		
		
	</view>
</template>
<style>
	.content{min-height: 100vh;background:rgb(245,245,249);}
	.content .topBox{width:100%;padding:40upx 0;background: #DC582A;}
	.content .topBox .headImage{width:120upx;height:120upx;border-radius: 120upx;float: left;margin:0 5%;}
	.content .topBox .right{width:65%;float: left;}
	.content .topBox .right .name{width:100%;color:#FFFFFF;font-size: 18px;font-weight: bold;letter-spacing: 2upx;margin-top: 10upx;margin-bottom:15upx;}
	.content .topBox .right .id{color:#FFFFFF;font-size: 24upx;;}
	.content .topBox .icon{float: left;margin-top: 40upx;}
	.content .bg_box{width: 100%;padding:0 5%;background: #DC582A;}
	.content .bg_box .isBg{width: 100%;padding:20upx;background-repeat: no-repeat;background-size: 100% 100%;}
	.content .bg_box .isBg .leftBox{width: 50%;float: left;}
	.content .bg_box .isBg .leftBox .name{width: 100%;color:#E1D7CD;font-size: 36upx;font-weight: bold;}
	.content .bg_box .isBg .leftBox .names{width: 100%;color:rgba(255,255,255,0.5);font-size: 24upx;margin-top: 10upx;}
	.content .bg_box .isBg .btnGo{width: auto;padding:10upx 20upx;border-radius: 100upx;margin-top:20upx;margin-right: 0;float: right;background: white;color:#262626;font-size: 24upx;}
	.content .bg_grey{width: 100%;background: rgb(245,245,249);}
	.content .bg_grey .rowsList{width:90%;margin-left: 5%;padding:20upx;border-bottom-left-radius: 15upx;border-bottom-right-radius: 15upx;background: white;}
	.content .bg_grey .rowsList .orderTitleBox{}
	.content .bg_grey .rowsList .orderTitleBox .name{height:40upx;line-height:40upxm;color:#333333;font-size: 32upx;font-weight: bold;float: left;}
	.content .bg_grey .rowsList .orderTitleBox .nameRight{height:40upx;line-height:40upxm;color:#BBBBBB;font-size: 24upx;float: right;}
	.content .bg_grey .iconList{width: 100%;display: flex;justify-content:space-between;margin-top: 40upx;}
	.content .bg_grey .iconList .iconBox{width: 20%;display: flex;justify-content:center;flex-wrap: wrap;}
	.content .bg_grey .iconList .iconBox .icon{width:52upx;height:52upx;}
	.content .bg_grey .iconList .iconBox .iconName{width:100%;color:#333333;font-size: 24upx;margin-top:10upx;text-align: center;}
	.content .bg_grey .bg_whites{width:90%;padding:20upx;margin-top: 20upx;margin-left: 5%;border-radius: 10upx;background:white;}
	.content .bg_grey .bg_whites .iconList{margin-top: 0;}
	.content .bg_grey .imageBox{padding:0}
	.content .bg_grey .imageBox .leftBox{width:60%;height:160upx;padding:20upx;padding-right: 0;float: left;}
	.content .bg_grey .imageBox .leftBox .iconName{width:100%;}
	.content .bg_grey .imageBox .leftBox .nameBox{width:100%;margin-top:30upx;}
	.content .bg_grey .imageBox .leftBox .nameBox .name{height:44upx;line-height: 44upx;color:#999999;float: left;font-size: 26upx;font-weight: bold;}
	.content .bg_grey .imageBox .leftBox .nameBox .getBtn{height:44upx;line-height: 44upx;float: left;background: #DC582A;font-size: 22upx;color:white;margin-left: 20upx;padding:0 10upx;border-radius: 100upx;}
	.content .bg_grey .imageBox .rightImage{width: 230upx;height: 160upx;float: right;}
	.content .bg_grey .iconLists{width: 100%;display: flex;justify-content:space-between;flex-wrap: wrap;}
	.content .bg_grey .marginTop{width: 25%;margin-top: 40upx;display: flex;justify-content:center;flex-wrap: wrap;}
	.content .bg_grey .marginTop .icon{width:52upx;height:52upx;}
	.content .bg_grey .marginTop .iconName{width:100%;color:#333333;font-size: 24upx;margin-top:10upx;text-align: center;}
	.content button::after{border: none;background:none;}
	.content button{line-height: 90% !important}
</style>
<script>
	import Share from '@/common/wx_share.js'
	export default {
		data() {
			return {
				share:{
					title:"",
					path:'/pages/tabbar/mine',
					imageUrl:'',
					desc:'',
					content:''
				},
				data:{
					headimgurl:"",
					nickname:"",
					user_sign:"",
					bg:"https://mp.darling.org.cn/mine.bg_1.png",
					tel:"",
					money:"",
					ad_pic:""
				},
				iconList:[
					{src:"/static/mine/icon_1.png",name:"待付款"},
					{src:"/static/mine/icon_2.png",name:"待发货"},
					{src:"/static/mine/icon_3.png",name:"待收货"},
					{src:"/static/mine/icon_4.png",name:"已完成"},
					{src:"/static/mine/icon_5.png",name:"退款/售后"},
				],
				toolsList:[
					{src:"/static/mine/icon_6.png",name:"钱包"},
					{src:"/static/mine/icon_7.png",name:"优惠券"},
					{src:"/static/mine/icon_8.png",name:"积分"},
					{src:"/static/mine/icon_9.png",name:"收藏"},
					{src:"/static/mine/icon_10.png",name:"历史浏览"},
				],
				serversList:[
					{src:"/static/mine/icon_13.png",name:"饮品订单"},
					{src:"/static/mine/icon_14.png",name:"积分订单"},
					{src:"/static/mine/icon_15.png",name:"店铺入驻"},
					{src:"/static/mine/icon_16.png",name:"我的地址"},
					{src:"/static/mine/icon_17.png",name:"邀请有礼"},
					{src:"/static/mine/icon_18.png",name:"客服电话"},
					{src:"/static/mine/icon_19.png",name:"联系我们"},
					{src:"/static/mine/icon_20.png",name:"设置"},
				],
				
				
			}
		},
		onLoad(){
			
			// var del_data = {
			// 	id: 124,
			// 	user_name: "冰丶疯1",
			// 	recode: "",
			// 	phone: "13399855390",
			// 	integral: 1667,
			// 	password: "dc483e80a7a0bd9ef71d8cf973673924",
			// 	summary: null,
			// 	paypwd: "96e79218965eb72c92a549dd5a330112",
			// 	appinfo_code: "",
			// 	headimgurl: "https://mp.darling.org.cn/FqN_6luQnM3qMJhB7A-BDiqF7Lsz",
			// 	xieyi: 0,
			// 	sex: 2,
			// 	birth: "2021-01-01",
			// 	email: null,
			// 	wxnum: null,
			// 	qqnum: null,
			// 	oauth: 1,
			// 	openid: "otzHU5POevAAhtCBqAMd556dP__w",
			// 	regtime: 1615358281,
			// 	qrcodeurl: "",
			// 	time_out: null,
			// 	one_level: 0,
			// 	two_level: 0,
			// 	checked: 1,
			// 	shop_id: 0,
			// 	follow: 0,
			// 	vip: 1,
			// 	vip_end_time: 1618195252,
			// 	member_level_id: 0,
			// 	economize: null,
				
			// 	// token: "65c91070592b82f9bf749f76ca13f0656ddc1e75"
			// 	token: "3103561b94cd05b9889c73e9fab593909d0403f5"
			// }
			// try {
			//     uni.setStorageSync('userInfo', del_data);
			// }catch(e){}
			
			// uni.navigateTo({
			// 	url:"/pages_kafei/pages/addr/addr"
			// })
		},
		onShow(){
			this.AjaxLoad()
		},
		methods: {
			AjaxLoad(){
				let param={
					token:this._$userToken("userInfo").token,
				};
				this._$InitRequest.request("MemberInfo/readprofile", param).then(res => {
					this.data.headimgurl = res.data.headimgurl
					this.data.nickname = res.data.user_name
					this.data.user_sign = res.data.phone
					this.data.money = res.data.year_fee
				},error=>{})
				
				
				
				// let params={
				// 	token:this._$userToken("userInfo").token,
				// 	type:15
				// };
				// this._$InitRequest.request("index/getad", params).then(res => {
				// 	this.data.ad_pic = res.data.ad_pic
				// },error=>{})
				
				let paramsA={
					token:this._$userToken("userInfo").token,
				};
				this._$InitRequest.request("MemberInfo/get_contact_us", paramsA).then(res => {
					this.data.tel = res.data.contact_us
				},error=>{})
			},
			btnSet(){
				uni.navigateTo({
					url:"/pages_mine/pages/set/set"
				})
			},
			toolBtn(e){
				if( e == 0 ){
					uni.navigateTo({
						url:"/pages_mine/pages/wallet/wallet"
					})
				}else if( e == 1 ){
					uni.navigateTo({
						url:"/pages_mine/pages/ticket/ticket"
					})
				}else if( e == 2 ){
					uni.navigateTo({
						url:"/pages_mine/pages/intergral/intergral"
					})
				}else if( e == 3 ){
					uni.navigateTo({
						url:"/pages_mine/pages/collect/collect"
					})
				}else if( e == 4 ){
					uni.navigateTo({
						url:"/pages_mine/pages/history/history"
					})
				}
			},
			toOrder(e){
				if( e == 4 ){
					uni.navigateTo({
						url:"/pages_mine/pages/order_PostSaleBack/order_PostSaleBack"
					})
				}else{
					e += 1
					uni.navigateTo({
						url:"/pages_mine/pages/order/order?index=" + e
					})
				}
			},
			btnServers(e){
				var that = this;
				if( e == 0 ){
					uni.navigateTo({
						url:"/pages_kafei/pages/order/order"
					})
				}else if( e == 1 ){
					uni.showToast({icon:"none",title:"正在开发中..."})
					return;
				}else if( e == 2 ){
					uni.navigateTo({
						url:"/pages_mine/pages/storeEntry/storeEntry"
					})
				}else if( e == 3 ){
					uni.navigateTo({
						url:"/pages_mine/pages/addr_mine/addr_mine"
					})
				}else if( e == 4 ){
					uni.navigateTo({
						url:"/pages_mine/pages/invite/invite"
					})
				}else if( e == 5 ){
					uni.showModal({
						title: '提示',
						content: '是否拨打平台客服电话\r\n'+that.data.tel,
						success: (res) => {
							if (res.confirm) {
								uni.makePhoneCall({
								    phoneNumber: that.data.tel,
									success: (res) => {
										console.log('成功!')
									},
									fail: (res) => {
										console.log('失败!')
									}
								});
							}else if(res.cancel){}
						}
					});
				}else if( e == 6 ){
					
				}else if( e == 7 ){
					uni.navigateTo({
						url:"/pages_mine/pages/setting/setting",
						success: ()=> {},
						fail: ()=> {},
						complete: ()=> {}
					})
				}
			},
			ToVip(){
				uni.navigateTo({
					url:"/pages_mine/pages/vip/vip"
				})
			},
			tapAdv(){
				uni.showToast({icon:"none",title:"正在开发中..."})
				return;
			},
			
			
			
			
			
			
			
			
			
			
		}
	}
</script>
<style lang="scss" scoped>
/deep/ .uni-input-input {font-size:32upx}
/deep/ .uni-radio-input-checked{background-color:rgb(110,43,34) !important;border:2upx solid white !important}
.content .html{
  ::v-deep {
    img {
      width: 100%;
    }
  }
}
</style>	